﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>事件冒泡</title>
    <style type="text/css">
        .red
        {
            width: 250px;
            height: 250px;
            position: absolute;
            background-color: #FF0000;
            cursor: pointer;
        }
        
        .green
        {
            width: 150px;
            height: 150px;
            position: absolute;
            background-color: Green;
            cursor: pointer;
        }
        p
        {
            width: 50px;
            height: 50px;
            position: absolute;
            background-color: #000000;
            cursor: pointer;
        }
    </style>
    <script src="../jquery-1.8.0.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("div").click(function () {
                alert($(this).html());
            });
        });
    </script>
</head>
<body>
    <div id="red" class="red">
        Red
        <div id="green" class="green">
            green
        </div>
    </div>
</body>
</html>
